package cn.lingyangwl.agile.pay.client.constants;

import cn.lingyangwl.framework.tool.core.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author shenguangyang
 */
@AllArgsConstructor
@Getter
public enum PayIfEnum {
    DEFAULT("0"),

    /**
     * 微信
     */
    WECHAT("1"),


    /**
     * 支付宝
     */
    ALI("2");

    private final String code;

    public static PayIfEnum of(String code) {
        return Arrays.stream(values()).filter(e -> e.getCode().equalsIgnoreCase(code)).findFirst()
                .orElseThrow(() -> new BizException("暂未实现支付类型 [{}]", code));
    }
}
